﻿@using Bifrost.Web.Mvc.Commands
@using Bifrost.Samples.Blog.Mvc.Features.Tags;
@using Bifrost.Samples.Blog.Domain.Tags.Commands;
@using Bifrost.Samples.Blog.Views.Tags;
@model IEnumerable<Tag>
@{
    ViewBag.Title = "Tag List";
}
<ul>
	@foreach (var tag in Model)
	{
		<li>
            @using (var form = Html.BeginCommandForm<DeleteTag, TagsController>(c => c.Create(null), FormMethod.Post))
            {
                @form.Html.HiddenFor(c => c.Id);
                @tag.Name
                @Html.ActionLink("Delete", "Delete", "Tags", new { id = tag.Id }, null)
            }
		</li>
    }
</ul>
@using (var form = Html.BeginCommandForm<CreateTag, TagsController>(c => c.Create(null), FormMethod.Post))
{
	@form.Html.HiddenFor(c => c.Id);
    @form.Html.LabelFor(c => c.TagName)
	@form.Html.TextBoxFor(c => c.TagName)
    @form.Html.ValidationMessageFor(c => c.TagName)
								
	<input type="submit" value="Create" />
}

